home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / BBS_UTL / BOI200P / DOORLIB.PAS < prev    next >
Pascal/Delphi Source File  |  1992-12-13  |  4KB  |  126 lines

  1. { $D-}  { Debug Information Off }
  2. {$S-}  { Stack Checking Off    }
  3. {$V-}  { String Checking Off   }
  4.  
  5. Unit DoorLib;
  6. { Part of BBS Onliner Interface }
  7. { Copyright (C) 1990,1992 Andrew J. Mead
  8.   All Rights Reserved. }
  9.  
  10. { original version 5/20/92
  11.   history found in IOLIB.PAS }
  12.  
  13. INTERFACE
  14.  
  15. Uses
  16.   dos;
  17.  
  18. Function INFOFILE : pathstr;
  19. Function TXTHOF   : pathstr;
  20. Function DATHOF   : pathstr;
  21. Function LOGFILE  : pathstr;
  22. Function DOORNAME : string;
  23. Function VERSION  : string;
  24.  
  25. Function PROGRAMSET(check : char) : boolean;
  26.  
  27. Procedure DL_SETVALUE(dl_index : byte; dl_new : pathstr);
  28.  
  29. IMPLEMENTATION
  30.  
  31. Uses
  32.   IOLib;
  33.  
  34. Type
  35.   dl_array = array [1..6] of pathstr;
  36.  
  37. Const
  38.   dl_table : dl_array = (
  39.  
  40. {$I DOORLIB.DAT}
  41.  
  42. {  (* Contents of sample DOORLIB.DAT *)
  43.       'HILOINFO.DOC',         (* HiLo documentation filename *)
  44.       'HILOHOF.TXT',          (* HiLo text Hall of Fame filename *)
  45.       'HILOHOF.DAT',          (* HiLo data Hall of Fame filename *)
  46.       'BOI.LOG',              (* activity / error log filename *)
  47.       'HiLo',                 (* game name *)
  48.       '2.00');                (* game version number *)
  49.  
  50.   dl_progset : set of char = [#00];
  51.                               (* valid additional command line switches *)
  52. {}
  53.  
  54. Function INFOFILE : pathstr; { filename of document file for installation help }
  55.   begin {* InfoFile *}
  56.     InfoFile := dl_table[1]
  57.   end;  {* InfoFile *}
  58.  
  59. Function TXTHOF : pathstr; { filename of default text Hall of Fame }
  60.   begin {* TxtHOF *}
  61.     TxtHOF := dl_table[2]
  62.   end;  {* TxtHOF *}
  63.  
  64. Function DATHOF : pathstr; { filename of data Hall of Fame }
  65.   begin {* DatHOF *}
  66.     DatHOF := dl_table[3]
  67.   end;  {* DatHOF *}
  68.  
  69. Function LOGFILE : pathstr; { filename of error/activity log }
  70.   begin {* fLogFile *}
  71.     LogFile := dl_table[4]
  72.   end;  {* fLogFile *}
  73.  
  74. Function DOORNAME : string; { name of the game }
  75.   begin {* fDoorName *}
  76.     DoorName := dl_table[5]
  77.   end;  {* fDoorName *}
  78.  
  79. Function VERSION : string; { current game version }
  80.   begin {* fVersion *}
  81.     Version := dl_table[6]
  82.   end;  {* fVersion *}
  83.  
  84. Function PROGRAMSET(          { check to see if character is valid command }
  85.     check : char) : boolean;  { line option. }
  86.  
  87.   begin {* fProgramSet *}
  88.     ProgramSet := check in dl_progset
  89.   end;  {* fProgramSet *}
  90.  
  91. Procedure DL_SETVALUE(   { change value in dl_table }
  92.     dl_index : byte;       { index of value to change }
  93.     dl_new   : pathstr);   { new dl_table value }
  94.  
  95.   begin {* DL_SetValue *}
  96.     if dl_index in [1..6] then { dl_index value is legal }
  97.         dl_table[dl_index] := dl_new { assign new value }
  98.   end;  {* DL_SetValue *}
  99.  
  100. Procedure CHECKENVIRONMENT;  { process environment variables }
  101.   var
  102.     envtemp : pathstr;
  103.  
  104.   begin {* CheckEnvironment *}
  105.     envtemp := GetEnv('BOILOG'); { check for environment variable }
  106.     CleanString(envtemp);
  107.     if Length(envtemp) = 0 then Exit; { no enviroment variable found, exit }
  108.     if (Pos('.',envtemp) = 0) then { filepath only }
  109.       begin
  110.         if not (envtemp[Length(envtemp)] in [':','\']) then { incomplete path }
  111.             envtemp := envtemp + '\';
  112.         envtemp := envtemp + dl_table[4] { add default filename to path }
  113.       end;
  114.     envtemp := FExpand(envtemp); { flush out path/filespec }
  115.     if Valid(envtemp) then { if this file is a legal DOS pathfilename then...}
  116.         DL_SetValue(4,envtemp) { replace default value }
  117.  
  118.     { BOIOPT environment variable will be added in the near future.  Currently}
  119.     { the log is only a fatal error log.  User activity and possibly formatting}
  120.     { options will be added. }
  121.   end;  {* CheckEnvironment *}
  122.  
  123. begin {* uDoorLib *}
  124.   CheckEnvironment
  125. end.  {* uDoorLib *}
  126.